package com.wsoft.mq.test.sample.topic;

import com.wsoft.mq.test.constant.RabbitTopicConstant;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author z001
 * @Date 2025/1/7 15:36
 */
@RestController
@RequestMapping("/fanout")
public class TopicSample {
    @Resource
    private RabbitTemplate rabbitTemplate;


    @GetMapping("/sendMessage1")
    public void sendMessage1(@RequestParam("routeKey") String routeKey,
                             @RequestParam("message") String message){
        rabbitTemplate.convertAndSend(RabbitTopicConstant.TOPIC_EXCHANGE
                , routeKey,
                message);
    }
}
